"""
Structures of common emails for one click setup and testing
Written by: Daniel Ortiz
Date: November 9 2007
Version: 0.0
"""
def prepackaged(query):
    domain_names = ['.com', '.org', '.edu']
    query = query.replace('http://', '', 1)
    query = query.replace('www.', '', 1)
    for d in domain_names:
        query = query.replace(d, '', 1)

    if query in domains:
        return True, query
    else:
        return False, query

def mail_strip(query):
    """Strip the ending of the email"""
    domain_names = ['.com', '.org', '.edu']
    for d in domain_names:
        query = query.replace(d, '', 1)
    query = query.replace('.', '_')
    return query

domains = ['google', 'gmail']

pop3_gmail = pop3_google = gmail = google = {
    'protocol' : 'pop3',
    'iserver' : 'pop.gmail.com',
    'iport' : 995,
    'issl' : True,
    'oserver' : 'smtp.gmail.com',
    'oport' : 587,
    'ossl' : False,
    'mail' : 'gmail.com'
}

imap4_gmail = imap4_google = {
    'protocol' : 'imap4',
    'iserver' : 'imap.gmail.com',
    'iport' : 993,
    'issl' : True,
    'oserver' : 'smtp.gmail.com',
    'oport' : 587,
    'ossl' : False,
    'mail' : 'gmail.com'
}

imap4_umail_ucsb = {
    'protocol' : 'imap4',
    'iserver' : 'incoming.umail.ucsb.edu',
    'iport' : 993, 
    'issl' : True,
    'oserver' : 'outgoing.umail.ucsb.edu',
    'ossl' : False,
    'oport' : 587,
    'mail' : 'umail.ucsb.edu'
}